//
//  HorizonViewDemoController.m
//  JackToolsBox
//
//  Created by Jack Xue on 2019/12/24.
//  Copyright © 2019 Jack Xue. All rights reserved.
//

#import "HorizonViewDemoController.h"
#import "JKHorizonView.h"
#import "JkNumberItem.h"
@interface HorizonViewDemoController ()<JKHorizonViewDataSource>

@end

@implementation HorizonViewDemoController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor lightGrayColor];
    
    JKHorizonView *view = [[JKHorizonView alloc]initWithFrame:CGRectMake(0, 100, JK_Main_Width, 100)];
    view.dataSource = self;
    [self.view addSubview:view];
}

-(NSInteger)numberOfItemsInHorizonView:(JKHorizonView *)horizonView{
    return 10;
}

-(JkHorizonItem *)horizonView:(JKHorizonView *)horizonView itemAtIndex:(NSInteger)index{
    JkNumberItem *item = (JkNumberItem*)[horizonView dequeueReusableItem];
    if (!item) {
        item = [[JkNumberItem alloc]initWithFrame:CGRectZero];
    }
    [item sendValueToItem:index];
    return item;
}
@end
